<html>
  <head>
  <title>foreach.py</title>
  </head>
  <body>
  <h3>foreach.py</h3>
  <hr>
  <pre>
fruits <span style="font-weight: bold">= [</span><span style="color: red">'apples'</span><span style="font-weight: bold">,</span><span style="color: red">'oranges'</span><span style="font-weight: bold">,</span><span style="color: red">'pears'</span><span style="font-weight: bold">,</span><span style="color: red">'bananas'</span><span style="font-weight: bold">]
</span><span style="color: blue; font-weight: bold">for </span>fruit <span style="color: blue; font-weight: bold">in </span>fruits<span style="font-weight: bold">:
    </span><span style="color: blue; font-weight: bold">print </span>fruit <span style="font-weight: bold">+ </span><span style="color: red">' for sale'
    
</span>fruitPrices <span style="font-weight: bold">= {</span><span style="color: red">'apples'</span><span style="font-weight: bold">:</span><span style="color: red">2.00</span><span style="font-weight: bold">, </span><span style="color: red">'oranges'</span><span style="font-weight: bold">: </span><span style="color: red">1.50</span><span style="font-weight: bold">, </span><span style="color: red">'pears'</span><span style="font-weight: bold">: </span><span style="color: red">1.75</span><span style="font-weight: bold">}
</span><span style="color: blue; font-weight: bold">for </span>fruit<span style="font-weight: bold">, </span>price <span style="color: blue; font-weight: bold">in </span>fruitPrices<span style="font-weight: bold">.</span>items<span style="font-weight: bold">():
    </span><span style="color: blue; font-weight: bold">print </span><span style="color: red">'%s cost %f a pound' </span><span style="font-weight: bold">% (</span>fruit<span style="font-weight: bold">, </span>price<span style="font-weight: bold">)</span>
  </pre>
  </body>
  </html>
  